package Scuttlebutt;

import java.awt.event.*;
import javax.swing.*;

public class EventCloseProject extends JMenuItem implements ActionListener 
{
	Scuttlebutt parent = null;
	
	public EventCloseProject(Scuttlebutt parent)
	{
		this.parent = parent;
		addActionListener(this);
	}
	
	public EventCloseProject(String text,Scuttlebutt parent)
	{
		super(text);
		this.parent = parent;
		addActionListener(this);
	}

	public void actionPerformed(ActionEvent a0)
	{
		if(parent.isConnected())
			parent.close();
			
		parent.getButtonBar().getConnectButton().setEnabled(false);
		parent.getButtonBar().enableNewProjectButton(true);
		parent.getButtonBar().enableOpenProjectButton(true);
		parent.getFileTransferTable().clear();
		parent.getProject().clear();
		parent.getEditPane().removeAll();
		parent.setTitle();
		parent.updateTree();
	}
}

